home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_05 / wittenb / hello.w < prev    next >
Encoding:
Text File  |  1994-04-15  |  565 b   |  28 lines

  1. \def\title{Listing 1}
  2.  
  3. @*A Simple Example.
  4. This is a trivial example of a \.{CWEB} program.
  5. It is, of course, the classic ``hello, world''
  6. program we all know and love:
  7.  
  8. @c
  9. @<Header files needed by the program@>@;
  10. @#
  11. main(void)
  12. {
  13.     @<Print the message |"hello, world"|@>@;
  14. }
  15.  
  16. @ Naturally, we use |printf| to do the dirty work:
  17.  
  18. @<Print the message |"hello, world"|@>=
  19. printf("hello, world\n");
  20.  
  21. @ The prototype for |printf| is in the standard
  22. header, \.{<stdio.h>}.
  23.  
  24. @<Header files needed by the program@>=
  25. #include <stdio.h>
  26.  
  27. @*Index.
  28.